package com.woniuxy.woniubookmanager.controller;


import com.woniuxy.woniubookmanager.entity.Booktype;
import com.woniuxy.woniubookmanager.result.ResponseResult;
import com.woniuxy.woniubookmanager.service.BooktypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wugd
 * @since 2022-11-29 04:03:13
 */
@RestController
@RequestMapping("/booktype")
public class BooktypeController {

    @Autowired
    BooktypeService booktypeService ;

    @GetMapping("/typeList")
    public ResponseResult<List<Booktype>> list(){
        ResponseResult<List<Booktype>> result = null;
        try {
            List<Booktype> list = booktypeService.list();
            result = new ResponseResult<>(200,"ok",list);
        }catch (RuntimeException e){
            result = new ResponseResult<>(201,"查询失败");
            e.printStackTrace();
        }
        return result ;
    }

}

